<script type="text/javascript" language="javascript">
    var sel;
    function OnContextMenu() {
        var parentwin = external.menuArguments;

        if (external.menuArguments) {
            var parentwin = external.menuArguments;
            if (parentwin.document.selection) {
                //alert("IE plugin testing, works");
                sel = parentwin.document.selection.createRange().text;
                //parentwin.document.location = "" + sel;
            }
            else {
                return;
            }
        }

        var mygetrequest = new ajaxRequest()
        mygetrequest.onreadystatechange = function () {
            if (mygetrequest.readyState == 4) {
                if (mygetrequest.status == 200 || window.location.href.indexOf("http") == -1) {
                    //alert(mygetrequest.responseText);
                }
                else {
                    alert("Server responsed error, please check the status of Direct HR Softphone Agent!");
                }
            }
        }
        mygetrequest.open("GET", "http://127.0.0.1:7069/" + "Dial" + "/0" + sel, true);
        mygetrequest.send(null);
    }


    function ajaxRequest()
    {
        var activexmodes = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];  //activeX versions to check for in IE
        if (window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
            for (var i = 0; i < activexmodes.length; i++) {
                try {
                    return new ActiveXObject(activexmodes[i]);
                }
                catch (e) {
                    //suppress error
                }
            }
        }
        else if (window.XMLHttpRequest) // if Mozilla, Safari etc
            return new XMLHttpRequest();
        else
            return false;
    }



    OnContextMenu();
</script>
</body> </html>